﻿namespace BEGDC.PreContract.DAL
{
    using System;
    using System.Collections.Generic;
    using Castle.ActiveRecord;
    using NHibernate.Expression;


    [ActiveRecord]
    public partial class SalesFeedback : ActiveRecordBase<SalesFeedback>
    {
        #region Const Definition

        public const string CONST_SalesFeedbackID = "ID";
        public const string CONST_PreContractID = "PreContractID";
        public const string CONST_SignType = "SignType";
        public const string CONST_TreatmentWay = "TreatmentWay";
        public const string CONST_OperationDate = "OperationDate";
        public const string CONST_InvoiceStatus = "InvoiceStatus";
        public const string CONST_CancelProcess = "CancelProcess";
        public const string CONST_ProblemLV1 = "ProblemLV1";
        public const string CONST_ProblemLV2 = "ProblemLV2";
        public const string CONST_Comments = "Comments";
        public const string CONST_DashboardIssueType = "DashboardIssueType";
        public const string CONST_PeopleInCharge = "PeopleInCharge";
        public const string CONST_Creator = "Creator";
        public const string CONST_CreateTime = "CreateTime";

        #endregion

        #region Member Variables

        // Primary Key
        private System.Int32 _ID;

        // Non Key
        private Nullables.NullableDateTime _operationDate;
        private System.String _comments;
        private System.String _peopleInCharge;
        private Nullables.NullableDateTime _createTime;

        // Parents
        private PreContractInfo _preContractID;
        private DicItem _signType;
        private DicItem _treatmentWay;
        private DicItem _invoiceStatus;
        private DicItem _cancelProcess;
        private DicItem _problemLV1;
        private DicItem _problemLV2;
        private DicItem _dashboardIssueType;
        private Employee _creator;

        #endregion

        public SalesFeedback()
        {

        }

        public SalesFeedback(
            Nullables.NullableDateTime operationDate
            , System.String comments
            , System.String peopleInCharge
            , Nullables.NullableDateTime createTime)
            : this()
        {
            this._operationDate = operationDate;
            this._comments = comments;
            this._peopleInCharge = peopleInCharge;
            this._createTime = createTime;
        }

        #region Properties

        // Primary Key        
#if (SQLServer)
        [PrimaryKey]
#else
[PrimaryKey(PrimaryKeyType.Native, SequenceName = "SEQ_SALESFEEDBACK_ID")]
#endif

        public System.Int32 ID
        {
            get { return this._ID; }
            set { this._ID = value; }
        }

        // Non Key

        [Property]
        public Nullables.NullableDateTime OperationDate
        {
            get { return this._operationDate; }
            set { this._operationDate = value; }
        }

        [Property]
        public Nullables.NullableDateTime CreateTime
        {
            get { return this._createTime; }
            set { this._createTime = value; }
        }

        [Property]
        public System.String Comments
        {
            get { return this._comments; }
            set { if (value == null) return; if (value.Length > 500) this._comments = value.Substring(0, 500); else this._comments = value; }
        }

        [Property]
        public System.String PeopleInCharge
        {
            get { return this._peopleInCharge; }
            set { if (value == null) return; if (value.Length > 50) this._peopleInCharge = value.Substring(0, 50); else this._peopleInCharge = value; }
        }

        // Parent Relationships
        [BelongsTo("SignType")]
        public DicItem SignType
        {
            get { return this._signType; }
            set { this._signType = value; }
        }

        [BelongsTo("TreatmentWay")]
        public DicItem TreatmentWay
        {
            get { return this._treatmentWay; }
            set { this._treatmentWay = value; }
        }

        [BelongsTo("InvoiceStatus")]
        public DicItem InvoiceStatus
        {
            get { return this._invoiceStatus; }
            set { this._invoiceStatus = value; }
        }

        [BelongsTo("CancelProcess")]
        public DicItem CancelProcess
        {
            get { return this._cancelProcess; }
            set { this._cancelProcess = value; }
        }

        [BelongsTo("ProblemLV1")]
        public DicItem ProblemLV1
        {
            get { return this._problemLV1; }
            set { this._problemLV1 = value; }
        }

        [BelongsTo("ProblemLV2")]
        public DicItem ProblemLV2
        {
            get { return this._problemLV2; }
            set { this._problemLV2 = value; }
        }

        [BelongsTo("DashboardIssueType")]
        public DicItem DashboardIssueType
        {
            get { return this._dashboardIssueType; }
            set { this._dashboardIssueType = value; }
        }

        [BelongsTo("PreContractID")]
        public PreContractInfo PreContractID
        {
            get { return this._preContractID; }
            set { this._preContractID = value; }
        }

        [BelongsTo("Creator")]
        public Employee Creator
        {
            get { return this._creator; }
            set { this._creator = value; }
        }

        // Child Relationships

        #endregion

        // Clone
        public SalesFeedback Clone()
        {
            SalesFeedback newSalesFeedback = new SalesFeedback();

            newSalesFeedback.PreContractID = this._preContractID;
            newSalesFeedback.SignType = this._signType;
            newSalesFeedback.TreatmentWay = this._treatmentWay;
            newSalesFeedback.OperationDate = this._operationDate;
            newSalesFeedback.InvoiceStatus = this._invoiceStatus;
            newSalesFeedback.CancelProcess = this._cancelProcess;
            newSalesFeedback.ProblemLV1 = this._problemLV1;
            newSalesFeedback.ProblemLV2 = this._problemLV2;
            newSalesFeedback.Comments = this._comments;
            newSalesFeedback.DashboardIssueType = this._dashboardIssueType;
            newSalesFeedback.PeopleInCharge = this._peopleInCharge;
            newSalesFeedback.Creator = this._creator;
            newSalesFeedback.CreateTime = this._createTime;

            return newSalesFeedback;
        }
    }
}



